Socket
Socket
Sign inDemoInstall

turbo-stream

Package Overview
Dependencies
0
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    turbo-stream

A streaming data transport format that aims to support built-in features such as Promises, Dates, RegExps, Maps, Sets and more.


Version published
Weekly downloads
255K
decreased by-4.6%
Maintainers
1
Install size
43.7 kB
Created
Weekly downloads
 

Changelog

Source

2.2.0 (2024-06-04)

Features

  • allow plugins to custom encode functions (#34) (6bd197a)

Readme

Source

Turbo Stream
turbo-stream's badge

A streaming data transport format that aims to support built-in features such as Promises, Dates, RegExps, Maps, Sets and more.

Decode runtime size: turbo-stream's badge

Shout Out!

Shout out to Rich Harris and his https://github.com/rich-harris/devalue project. Devalue has heavily influenced this project and portions of the code have been directly lifted from it. I highly recommend checking it out if you need something more cusomizable or without streaming support.

Installation

npm install turbo-stream

Usage

import { decode, encode } from "turbo-stream";

const encodedStream = encode(Promise.resolve(42));
const decoded = await decode(encodedStream);
console.log(decoded.value); // a Promise
console.log(await decoded.value); // 42
await decoded.done; // wait for the stream to finish

Stackblitz: https://stackblitz.com/edit/stackblitz-starters-2wm7dh?file=index.js React SSR Example: https://github.com/jacob-ebey/turbo-stream-react-example

Keywords

FAQs

Last updated on 04 Jun 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc